package com.fmsz.xmly.adapters.broadcast;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.fmsz.xmly.entitys.broadcast.ProvinceListEntity;
import com.fmsz.xmly.fragments.findfgts.BroadProvinceBaseFgt;

import java.util.List;

/**
 * Created by Administrator on 2016/12/7.
 */

public class ProvincePagerAdapter extends FragmentPagerAdapter {

    private List<ProvinceListEntity.ResultEntity> list;

    public ProvincePagerAdapter(FragmentManager fm, List<ProvinceListEntity.ResultEntity> titles) {
        super(fm);
        this.list = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return BroadProvinceBaseFgt.newInstance(list.get(position).getProvinceCode());
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position).getProvinceName();
    }
}
